UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DhC7aN382Z+9eL1dCs7ncOb/RGHXoD4R6rJ3gzwNGyA=' 
WHERE 
  key_id = 'f3972255df05628b987f3f80ba0bda1fec3574624d090b4c518ed0b4d878d13a' 
  AND (
    token = 'DhC7aN382Z+9eL1dCs7ncOb/RGHXoD4R6rJ3gzwNGyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033