UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lztr4tJ0Po0ydOQ93WUEcMoD945DzAatc/tjnFwCiXo=' 
WHERE 
  key_id = '36e55e25d8374702c1bdcb5dba1c20627c6f3741256dc2d24ada3a294142576e' 
  AND (
    token = 'lztr4tJ0Po0ydOQ93WUEcMoD945DzAatc/tjnFwCiXo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00069