UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SjhhIxF+lgU6rXqNuAGouWFcH4vDVz+eapIgFEg/f4E=' 
WHERE 
  key_id = '156935cf09917a639362e903413ffddaadeed78414528f786a246157d525c591' 
  AND (
    token = 'SjhhIxF+lgU6rXqNuAGouWFcH4vDVz+eapIgFEg/f4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046