UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q8pj9duOYPxTCIFg/59yrqX83ICvhj/Y4oh4ShRWzGc=' 
WHERE 
  key_id = '8180e362b45dedca803a6c091f0a8062c544c922a349aae1efcd33d878bf74e1' 
  AND (
    token = 'Q8pj9duOYPxTCIFg/59yrqX83ICvhj/Y4oh4ShRWzGc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050