UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j9Rajh3mEKrL4ZexV/zZmKMEG88J4Hpmy5HiP/g4ZJ0=' 
WHERE 
  key_id = 'f6571d0978d6816b79f31be87674cb3ccd2dd21ec3384bdf4b7fe28393061a90' 
  AND (
    token = 'j9Rajh3mEKrL4ZexV/zZmKMEG88J4Hpmy5HiP/g4ZJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034