UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7w4/ISFFFmZ8ALUj6nEOfvgFeGWKBEcghrh6LjT+mH0=' 
WHERE 
  key_id = '244cdceec151c8fdb0ca62c47a7b66afcd81909c5746aff81217659a9132201a' 
  AND (
    token = '7w4/ISFFFmZ8ALUj6nEOfvgFeGWKBEcghrh6LjT+mH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031