UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AgepuXpOvXBCF9XxILZ8ZHE8C5GXgb31e7Iy0xCfokk=' 
WHERE 
  key_id = '281ba717cca2ffc695c920b505eef50cd332a1478f18072e66fcd9f390542781' 
  AND (
    token = 'AgepuXpOvXBCF9XxILZ8ZHE8C5GXgb31e7Iy0xCfokk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043