UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C5o8lWux1np6jqbiUNJx9r+qLSuCMxhDm453iMNHRmU=' 
WHERE 
  key_id = 'e6877b35cc0680666fcfb28c0874c6f1f6f47e5c263a2f91a1abc7f28950341a' 
  AND (
    token = 'C5o8lWux1np6jqbiUNJx9r+qLSuCMxhDm453iMNHRmU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034