UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I2zcF+8m+fQuESFpfzJaPFBa1lfhMd3a3pFux51N3BU=' 
WHERE 
  key_id = '37eb06cb360de793ee5f4cca5072d4e0de66e9ce7e06b24090524229418cac82' 
  AND (
    token = 'I2zcF+8m+fQuESFpfzJaPFBa1lfhMd3a3pFux51N3BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057