UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uH7l1pe0ka10j/idDbtbvZhS/THuS5VK7ei0DzxknH8=' 
WHERE 
  key_id = '9b8d43318e6c72232d98d7be6569fe5a08635894cfd23d229d1e9ce6929e5535' 
  AND (
    token = 'uH7l1pe0ka10j/idDbtbvZhS/THuS5VK7ei0DzxknH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037