UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ou+vUyB5gUdk8qJZ6U9KEtBXOOk+p5mHLxyJTO51png=' 
WHERE 
  key_id = '237be74cb4aa6d9729e66967d564844e21b5c173a8376744bf224425f2006b17' 
  AND (
    token = 'ou+vUyB5gUdk8qJZ6U9KEtBXOOk+p5mHLxyJTO51png=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046