UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8vsxld3f4vC12GrPkc2iF6FoqqrOZlJu3SPB59wHt+4=' 
WHERE 
  key_id = '36aa60c39b2afc23a00dad663acb8721d7aaf54b68abcdfdf0b827c550873679' 
  AND (
    token = '8vsxld3f4vC12GrPkc2iF6FoqqrOZlJu3SPB59wHt+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032