UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G6XDCRfGuvOSM6VZ2hC/wVFscc8K+IBIuHF7f12Z5Wg=' 
WHERE 
  key_id = '654c765abc714e9d8227bcbf0625b398ba2c14459b3acfc8b04085cd1b1035ec' 
  AND (
    token = 'G6XDCRfGuvOSM6VZ2hC/wVFscc8K+IBIuHF7f12Z5Wg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027