UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p6q0BmE63S5Ll+I/l1B6p59Ih5unFD5a6XUeMdQVL8s=' 
WHERE 
  key_id = '9fdb5bee5fdfea069ad36d204719e2d624ae5c8f19c9cfd69aa05f3c383cedd5' 
  AND (
    token = 'p6q0BmE63S5Ll+I/l1B6p59Ih5unFD5a6XUeMdQVL8s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032