UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sUD4KBNwYWgiuUCE4/p6q4bB4GiR2oI4xB7yY3uy/c8=' 
WHERE 
  key_id = '2af30e50b938149ba1337911026f8065d74f98f3c5402c3a6f5e2b15a5b6309e' 
  AND (
    token = 'sUD4KBNwYWgiuUCE4/p6q4bB4GiR2oI4xB7yY3uy/c8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037