UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r864An3U4Zsij+af8uSSshnjbc54vO9gJhxBI+enxaY=' 
WHERE 
  key_id = '2c16fb90d14765c538d00092e3560c06079421859c40c89a8fdfe2c3453f9bcd' 
  AND (
    token = 'r864An3U4Zsij+af8uSSshnjbc54vO9gJhxBI+enxaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042