UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXXbGNBPJdpX+YynOXZsE8+zmUfctSg4xsWR860w7Iw=' 
WHERE 
  key_id = '27062c28a466a7acb923a41910f2323e13d3aa5c568b6f036d6a441117e9f958' 
  AND (
    token = 'hXXbGNBPJdpX+YynOXZsE8+zmUfctSg4xsWR860w7Iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033