UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gvk6Wizgk8FDOw4FHP99nNo1UpADYuogkJ+TP2tdfGE=' 
WHERE 
  key_id = '813b4ad2e61f56c86ad8c258b7ae3e331ef060f0e9dc508abdc62319c9d642d6' 
  AND (
    token = 'gvk6Wizgk8FDOw4FHP99nNo1UpADYuogkJ+TP2tdfGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036