UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c5Cjz80Xw+Ycouw5V3llAmwALXAvBSTPZV8wbsX4GfA=' 
WHERE 
  key_id = '873d0ef77875bab1049850ae923b8e3122ba15c4923e58b22d3dc916f37fc551' 
  AND (
    token = 'c5Cjz80Xw+Ycouw5V3llAmwALXAvBSTPZV8wbsX4GfA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046