UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWxzi2LLUQjB6yPa0t7fM91nCbspgaS4B0heDruBjgA=' 
WHERE 
  key_id = 'bcc576d284fcfbc618ee533a21409b5b8bff3b9c5c79fb18fbc39cfeae3c6482' 
  AND (
    token = 'qWxzi2LLUQjB6yPa0t7fM91nCbspgaS4B0heDruBjgA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038