UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P31CfLUGsq+cTw+3Mhz5g3ZF82f9hZJQrMHrwynR1xg=' 
WHERE 
  key_id = '20187af1df3972eee8f8c5233621352d61328a6ba009c25ccd7d86f9cbb930a9' 
  AND (
    token = 'P31CfLUGsq+cTw+3Mhz5g3ZF82f9hZJQrMHrwynR1xg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032