UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R59y6FLHLNXw5P1126ETwDr1WU8u2x6oWvusl5Ql93U=' 
WHERE 
  key_id = 'ccfce0599289623fff70de62c76cfbc8c75747c0dc87a2ca3e57f8c3c01e54ad' 
  AND (
    token = 'R59y6FLHLNXw5P1126ETwDr1WU8u2x6oWvusl5Ql93U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046