UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f0+dyfy2v8ksPq/6D25Cru1vtwhm912C13jx4o90sXE=' 
WHERE 
  key_id = '8431976c6cd9833508fcf3916d6ba39355626808eb51d9714f3455430021d68a' 
  AND (
    token = 'f0+dyfy2v8ksPq/6D25Cru1vtwhm912C13jx4o90sXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031