UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9HWlFcl2jTj58pjfC/QETc8HUmhRIpFSp50Hiac4Xq4=' 
WHERE 
  key_id = 'ad9fbc3ff2a71b4a100571774f1fd931efe00f6580e5bdc4c6f28fbd31970068' 
  AND (
    token = '9HWlFcl2jTj58pjfC/QETc8HUmhRIpFSp50Hiac4Xq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052