UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x7Lbs4bqA1N1RDBEwodsbOUn/g01Lrj8qrbkkzXyr4M=' 
WHERE 
  key_id = '9793bccdb3de04bd38f15375039cbdcf7778937b527aa3c3b2e19c35219823e9' 
  AND (
    token = 'x7Lbs4bqA1N1RDBEwodsbOUn/g01Lrj8qrbkkzXyr4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025