UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JKNP2i/c0iBOyflLTPCT45DA0IPRFPf3ZOz+Voh+EFc=' 
WHERE 
  key_id = '9413af278002e47d3585070093bbfb71d47f59864b1187fc9d403a48045918fd' 
  AND (
    token = 'JKNP2i/c0iBOyflLTPCT45DA0IPRFPf3ZOz+Voh+EFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020